package main

import (
	"io/ioutil"
	"net/http"
)

func main() {
	// http包
	client := http.Client{}
	res, err := client.Get("https://www.baidu.com")
	if err != nil {
		panic(err)
	}

	contentType := res.Header.Get("Content-Type")
	date := res.Header.Get("Date")
	server := res.Header.Get("Server")

	println("Content-Type:", contentType)
	println("Date:", date)
	println("Server:", server)

	url := res.Request.URL
	code := res.StatusCode
	status := res.Status

	println("url:", url)
	println("code:", code)
	println("status:", status)

	body := res.Body
	readBody, err := ioutil.ReadAll(body)
	if err != nil {
		panic(err)
	}
	println("body", string(readBody))

}
